/*
 * 文 件    名:  CustomerPhotosModel.java
 * 创建日期:  2012-10-29上午11:00:40
 * 版          权:  Epro Technologies Co., Ltd. Copyright 2011-2012,  All rights reserved
 * 作          者:  yw66009
 */
package com.weipu.common.facade.model;

import java.io.Serializable;
import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/** 
 * 顾客照片上传的model
 * @version [版本号, 2013-3-26]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 * 
 * @author xrj66010
 */

public class CustomerPhotosModel implements Serializable
{
    /** 
     * @Fields serialVersionUID : 序列版本号
     */
    private static final long serialVersionUID = 7972608964433196435L;
    
    /** 
     * @Fields id :主键ID
     */
    private int id;
    
    /** 
     * @Fields timesTamp : 发布时间
     */
    private String timesTamp;
    
    /** 
     * @Fields userName : 用户名
     */
    private String userName;
    
    /** 
     * @Fields cicid :CICID
     */
    private int cicid;
    
    /** 
     * @Fields sku : SKU号码
     */
    private int sku;
    
    /** 
     * @Fields skuTitle : SKU标题
     */
    private String skuTitle;
    
    /** 
     * @Fields skuUrl : SKU连接地址
     */
    private String skuUrl;
    
    /** 
     * @Fields caption : 图片标题
     */
    private String caption;
    
    /** 
     * @Fields width :图片宽度
     */
    private int width;
    
    /** 
     * @Fields height :图片高度
     */
    private int height;
    
    /** 
     * @Fields thumbURL : 缩略图地址
     */
    private String thumbURL;
    
    /** 
     * @Fields pictureURL : 图片地址
     */
    private String pictureURL;
    
    /** 
     * @Fields verifiedOwner : 经证实的所有者
     */
    private boolean verifiedOwner;
    
    /** 
     * @Fields pointsRewarded : 积分奖励数
     */
    private int pointsRewarded;
    
    /** 
     * @Fields comments : 评论回复数
     */
    private int comments;
    
    /** 
     * @Fields helpfuls : 有用的数
     */
    private int helpfuls;
    
    /** 
     * @Fields parentID :上级图片ID
     */
    private int parentID;
    
    public int getId()
    {
        return id;
    }
    
    public void setId(int id)
    {
        this.id = id;
    }
    
    public String getTimesTamp()
    {
        return timesTamp;
    }
    
    public void setTimesTamp(String timesTamp)
    {
        this.timesTamp = timesTamp;
    }
    
    public String getUserName()
    {
        return userName;
    }
    
    public void setUserName(String userName)
    {
        this.userName = userName;
    }
    
    public int getCicid()
    {
        return cicid;
    }
    
    public void setCicid(int cicid)
    {
        this.cicid = cicid;
    }
    
    public int getSku()
    {
        return sku;
    }
    
    public void setSku(int sku)
    {
        this.sku = sku;
    }
    
    public String getSkuTitle()
    {
        return skuTitle;
    }
    
    public void setSkuTitle(String skuTitle)
    {
        this.skuTitle = skuTitle;
    }
    
    public String getSkuUrl()
    {
        return skuUrl;
    }
    
    public void setSkuUrl(String skuUrl)
    {
        this.skuUrl = skuUrl;
    }
    
    public String getCaption()
    {
        return caption;
    }
    
    public void setCaption(String caption)
    {
        this.caption = caption;
    }
    
    public int getWidth()
    {
        return width;
    }
    
    public void setWidth(int width)
    {
        this.width = width;
    }
    
    public int getHeight()
    {
        return height;
    }
    
    public void setHeight(int height)
    {
        this.height = height;
    }
    
    public String getThumbURL()
    {
        return thumbURL;
    }
    
    public void setThumbURL(String thumbURL)
    {
        this.thumbURL = thumbURL;
    }
    
    public String getPictureURL()
    {
        return pictureURL;
    }
    
    public void setPictureURL(String pictureURL)
    {
        this.pictureURL = pictureURL;
    }
    
    public boolean isVerifiedOwner()
    {
        return verifiedOwner;
    }
    
    public void setVerifiedOwner(boolean verifiedOwner)
    {
        this.verifiedOwner = verifiedOwner;
    }
    
    public int getPointsRewarded()
    {
        return pointsRewarded;
    }
    
    public void setPointsRewarded(int pointsRewarded)
    {
        this.pointsRewarded = pointsRewarded;
    }
    
    public int getComments()
    {
        return comments;
    }
    
    public void setComments(int comments)
    {
        this.comments = comments;
    }
    
    public int getHelpfuls()
    {
        return helpfuls;
    }
    
    public void setHelpfuls(int helpfuls)
    {
        this.helpfuls = helpfuls;
    }
    
    public int getParentID()
    {
        return parentID;
    }
    
    public void setParentID(int parentID)
    {
        this.parentID = parentID;
    }
    
    /**
      * JSON解析
      * @param json
      * @return  [参数说明]
      * @return CustomerPhotosModel [返回类型说明]
      * @exception throws [违例类型] [违例说明]
      * @see [类、类#方法、类#成员]
      */
    public static CustomerPhotosModel json2customer(JSONObject json)
    {
        if (null == json)
        {
            return null;
        }
        
        CustomerPhotosModel photosModel = new CustomerPhotosModel();
        photosModel.setId(json.optInt("ID"));
        photosModel.setCaption(json.optString("Caption"));
        photosModel.setCicid(json.optInt("CICID"));
        photosModel.setTimesTamp(json.optString("Timestamp"));
        photosModel.setUserName(json.optString("Username"));
        photosModel.setSku(json.optInt("Sku"));
        photosModel.setSkuTitle(json.optString("SKUTitle"));
        photosModel.setSkuUrl(json.optString("SKUUrl"));
        photosModel.setWidth(json.optInt("Width"));
        photosModel.setHeight(json.optInt("Height"));
        photosModel.setThumbURL(json.optString("ThumbURL"));
        photosModel.setPictureURL(json.optString("PictureURL"));
        photosModel.setVerifiedOwner(json.optBoolean("VerifiedOwner"));
        photosModel.setPointsRewarded(json.optInt("PointsRewarded"));
        photosModel.setComments(json.optInt("Comments"));
        photosModel.setHelpfuls(json.optInt("Helpfuls"));
        photosModel.setParentID(json.optInt("ParentID"));
        return photosModel;
    }
    
    /**
      * 将解析的Model放入ArrayList中
      * @param jsonArray
      * @return  [参数说明]
      * @return ArrayList<CustomerPhotosModel> [返回类型说明]
      * @exception throws [违例类型] [违例说明]
      * @see [类、类#方法、类#成员]
      */
    public static ArrayList<CustomerPhotosModel> jsonArray2customer(JSONArray jsonArray)
    {
        ArrayList<CustomerPhotosModel> photosModels = new ArrayList<CustomerPhotosModel>();
        for (int i = 0; i < jsonArray.length(); i++)
        {
            try
            {
                photosModels.add(json2customer(jsonArray.getJSONObject(i)));
            }
            catch (JSONException e)
            {
                e.printStackTrace();
            }
        }
        return photosModels;
    }
    
}
